package DAOJPA;

import java.util.List;

import personne.Personne;
import film.Film;
import DAO.DAO;
import DAO.DAORecompense;
import recompenses.Recompense;

public class DAORecompenseJPA extends DAO implements DAORecompense{

	static private DAORecompenseJPA instance = null;
	
	private DAORecompenseJPA() {
	}
		static public DAORecompense getInstance() {
		 	if (instance == null)
				instance = new DAORecompenseJPA();
			 	
		 	return instance;
	}
	
	
	@Override
	public Recompense getRecompense(int code) {
		// TODO Auto-generated method stub
		return DAO.getManager().createQuery("SELECT a FROM Recompense a WHERE a.code_rec = :code",Recompense.class).setParameter("code", code).getSingleResult();

	}

	@Override
	public List<Recompense> loadAll() {
		// TODO Auto-generated method stub
		return DAO.getManager().createQuery("SELECT a FROM Recompense a", Recompense.class).getResultList();
	}

	@Override
	public int getNombreRecompense() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void save(Recompense a) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(Recompense a) {
		// TODO Auto-generated method stub
		
	}

}
